/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 obelisk_reward.h

	$Header: $

	$NoKeywords: $

 ************************************************************************/

#if !defined( OBELISK_REWARD_H_INCLUDED )
#define OBELISK_REWARD_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <iosfwd>

#include "artifact.h"
#include "counted_ptr.h"
#include "obelisk_reward_ptr.h"
#include "sized_int_types.h"
#include "uncopyable.h"

enum t_artifact_type;
enum t_material;
class t_army;
class t_basic_dialog;

// -------------------------------------------------------------------
// Base class for obelisk rewards
// -------------------------------------------------------------------
class t_obelisk_reward : public t_counted_object, public t_uncopyable
{
	public:
		virtual void				add_to_basic_dialog( t_basic_dialog& dialog );
		virtual void				give_reward( t_army * army );
		static t_obelisk_reward_ptr read( std::streambuf & stream );
		static t_obelisk_reward_ptr read_from_map( std::streambuf & stream );
		virtual bool				write( std::streambuf & stream ) const = 0;

	protected:
		virtual bool				read_data( std::streambuf & stream, int version ) = 0;
		virtual bool				read_data_from_map( std::streambuf & stream, int version ) = 0;
};


// -------------------------------------------------------------------
// A reward of an artifact
// -------------------------------------------------------------------
class t_obelisk_reward_artifact : public t_obelisk_reward
{
	public:
		t_obelisk_reward_artifact();
		explicit t_obelisk_reward_artifact( t_artifact_type type, t_uint32 count = 1 );

		virtual void add_to_basic_dialog( t_basic_dialog& dialog );
		virtual void give_reward( t_army * army );
		virtual bool write( std::streambuf & stream ) const;

	protected:
		virtual bool read_data( std::streambuf & stream, int version );
		virtual bool read_data_from_map( std::streambuf & stream, int version );

	private:
		t_artifact  m_artifact;
		t_uint32	m_count;
};

// -------------------------------------------------------------------
// A reward of some materials
// -------------------------------------------------------------------
class t_obelisk_reward_material : public t_obelisk_reward
{
	public:
		t_obelisk_reward_material();
		t_obelisk_reward_material( t_material material, t_uint32 amount );

		virtual void add_to_basic_dialog( t_basic_dialog& dialog );
		virtual void give_reward( t_army * army );
		virtual bool write( std::streambuf & stream ) const;

	protected:
		virtual bool read_data( std::streambuf & stream, int version );
		virtual bool read_data_from_map( std::streambuf & stream, int version );

	private:
		t_uint32	m_amount;
		t_material  m_material;
};


#endif // OBELISK_REWARD_H_INCLUDED
